/**
 * 订单页横板tab组件
 *
 * @author 赵泽雨
 * @date 2021/02/21 18：10
 */

var app = getApp();
var order_list_id = getApp().order_list_id;

Component({
  properties: {
    height: {
      type: String,
      value: '64rpx'
    },
    // tab的背景颜色
    color: {
      type: String,
      value: '#172991'
    },
    tabList: {
      type: Array,
      value: [
        { id: 1, text: '全部' },
        { id: 2, text: '待付款' },
        { id: 3, text: '待收货' },
        { id: 4, text: '退款/售后' },
      ]
    }
  },
  data: {
    lineHeight: '',
    active: 1
  },
  methods: {
    changeTab(e) {
      console.log(e.currentTarget.dataset.id);
      let id = e.currentTarget.dataset.id;
      this.setData({ active: id })
      // this.triggerEvent('changeTab', id);
       app.globalData.order_list_id = id;  
    }
  },
  lifetimes: {
    attached() {
      this.setData({
        lineHeight: parseFloat(this.properties.height) - 4 + 'rpx'
      })
    }
  }
})